package com.example.peibei.ui.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.dingtao.common.bean.BillRecord;
import com.example.peibei.R;

import java.util.List;

public class BillRecordDetailAdapter extends BaseQuickAdapter<BillRecord.RecordsDTO.ItemDTO, BaseViewHolder> {
    Context context;

    public BillRecordDetailAdapter(@Nullable List<BillRecord.RecordsDTO.ItemDTO> data, Context context) {
        super(R.layout.item_bill_record_detail, data);
        this.context = context;
    }

    @Override
    protected void convert(BaseViewHolder helper, BillRecord.RecordsDTO.ItemDTO item) {
        ImageView iv_bill_head = helper.getView(R.id.iv_bill_head);
        switch (item.getTradeType()) {
            case 0://消费
                iv_bill_head.setBackgroundResource(R.mipmap.bill_money);
                break;
            case 1:
            case 2://充值提现
                iv_bill_head.setBackgroundResource(R.mipmap.bill_bank);
                break;
            case 5://充值提现
                iv_bill_head.setBackgroundResource(R.mipmap.tuigang_icon);
                break;
//            case 3:
//            case 4://订单取消退回、完成订单
//                iv_bill_head.setBackgroundResource(R.mipmap.bill_order);
//                break;
            default:iv_bill_head.setBackgroundResource(R.mipmap.bill_order);
        }
        helper.setText(R.id.tv_type, item.getTips()).setText(R.id.pay_time, item.getPayTime()).setText(R.id.tv_money, item.getStrMoney());
    }
}
